package com.ostrich.demomvvm.ui.home.viewmodel

import androidx.lifecycle.LiveData
import com.ostrich.demomvvm.mvvm.BaseViewModel
import com.ostrich.demomvvm.net.BaseResponse
import com.ostrich.demomvvm.ui.home.entity.VideoEntity
import com.ostrich.demomvvm.ui.home.repository.HomeRepository

/**
 * @Author : yaotianxue
 * @Time : On 2023/10/19 08:21
 * @Description : HomeViewModel
 */
class HomeViewModel:BaseViewModel() {
    //惰性：甚么时候使用甚么时候初始化
    private val homeRepository by lazy { HomeRepository() }
    fun findVideos(currentPage:Int, pageSize:Int): LiveData<BaseResponse<MutableList<VideoEntity>>> {
        return homeRepository.findVideos(currentPage,pageSize)
    }

    fun findVideoByName( keywords:String): LiveData<BaseResponse<MutableList<VideoEntity>>> {
        return homeRepository.findVideoByName(keywords)
    }
}